import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '生产日期',
    align:"center",
    dataIndex: 'productionDate'
   },
   {
    title: '采购订单行号',
    align:"center",
    dataIndex: 'purchaseOrderLineNumber'
   },
   {
    title: '物料编码',
    align:"center",
    dataIndex: 'materialCode'
   },
   {
    title: '物料名称',
    align:"center",
    dataIndex: 'materialName'
   },
   {
    title: '采购订单数量',
    align:"center",
    dataIndex: 'purchaseOrderQuantity'
   },
   {
    title: '已入库',
    align:"center",
    dataIndex: 'incomingQuantity'
   },
   {
    title: '出库',
    align:"center",
    dataIndex: 'outboundQuantity'
   },
   {
    title: '测试数量',
    align:"center",
    dataIndex: 'numberOfTests'
   },
   {
    title: '测试不良数量',
    align:"center",
    dataIndex: 'numberOfDefectsTested'
   },
   {
    title: '外观检验数量',
    align:"center",
    dataIndex: 'quantityOfVisualInspection'
   },
   {
    title: '外观不良数量',
    align:"center",
    dataIndex: 'numberOfBadAppearance'
   },
   {
    title: '直通率',
    align:"center",
    dataIndex: 'passRate'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '生产日期',
    field: 'productionDate',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '采购订单行号',
    field: 'purchaseOrderLineNumber',
    component: 'Input',
  },
  {
    label: '物料编码',
    field: 'materialCode',
    component: 'Input',
  },
  {
    label: '物料名称',
    field: 'materialName',
    component: 'Input',
  },
  {
    label: '采购订单数量',
    field: 'purchaseOrderQuantity',
    component: 'InputNumber',
  },
  {
    label: '已入库',
    field: 'incomingQuantity',
    component: 'InputNumber',
  },
  {
    label: '出库',
    field: 'outboundQuantity',
    component: 'InputNumber',
  },
  {
    label: '测试数量',
    field: 'numberOfTests',
    component: 'InputNumber',
  },
  {
    label: '测试不良数量',
    field: 'numberOfDefectsTested',
    component: 'InputNumber',
  },
  {
    label: '外观检验数量',
    field: 'quantityOfVisualInspection',
    component: 'InputNumber',
  },
  {
    label: '外观不良数量',
    field: 'numberOfBadAppearance',
    component: 'InputNumber',
  },
  {
    label: '直通率',
    field: 'passRate',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  productionDate: {title: '生产日期',order: 0,view: 'datetime', type: 'string',},
  purchaseOrderLineNumber: {title: '采购订单行号',order: 1,view: 'text', type: 'string',},
  materialCode: {title: '物料编码',order: 2,view: 'text', type: 'string',},
  materialName: {title: '物料名称',order: 3,view: 'text', type: 'string',},
  purchaseOrderQuantity: {title: '采购订单数量',order: 4,view: 'number', type: 'number',},
  incomingQuantity: {title: '已入库',order: 5,view: 'number', type: 'number',},
  outboundQuantity: {title: '出库',order: 6,view: 'number', type: 'number',},
  numberOfTests: {title: '测试数量',order: 7,view: 'number', type: 'number',},
  numberOfDefectsTested: {title: '测试不良数量',order: 8,view: 'number', type: 'number',},
  quantityOfVisualInspection: {title: '外观检验数量',order: 9,view: 'number', type: 'number',},
  numberOfBadAppearance: {title: '外观不良数量',order: 10,view: 'number', type: 'number',},
  passRate: {title: '直通率',order: 11,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}